var express = require('express');
var router = express.Router();

router.get('/', function(req, res, next) {
    res.render('./BlogManager/login', { title: 'login' });
});

router.post('/', function (req, res, next) {
    console.log('*******************');
    console.log(req.body);

    // res.redirect('/');

    var parms = req.body;

    if (parms.name == 'ace') {
        // res.render('index', { title: 'login' });
        res.redirect('/');
        // res.redirect('index', { title: 'login' });
    } else {
        res.status(404).render('404');
    }

    // res.json(req.body);
});


module.exports = router;
